/*
 * @Author: Wanko
 * @Date: 2024-04-05 16:33:12
 * @LastEditors: Wanko
 * @LastEditTime: 2024-06-29 19:49:54
 * @Description:
 */
const path = require('path')
const debug = require('./env')

const BASE_URL = 'https://www.wanko.top'
const { name } = require('../package.json')

const DB_NAME = name

const CONNECT_STR_DEV = `mongodb://localhost:27017/${DB_NAME}`

const CONNECT_STR_PRO = `mongodb://card:111111@101.35.252.97:27017/${DB_NAME}`

const FIRE_DIR = debug ? path.join(__dirname, 'public') : '/public/image'


const LOCAL_STATIC_PATH = path.join(__dirname, 'public')

const PROD_STATIC_PATH = `/public/project/${name}`

const JWT_SCRIPT = 'wanko-jwt-secret'
const JWT_REFRESH_SCRIPT = 'wanko-jwt-refresh-secret'

const JWT_EXPIRT_IN = '3d'
const JWT_REFRESH_EXPIRE_IN = '7d'

module.exports = {
  BASE_URL,
  FILR_URL: `${BASE_URL}${PROD_STATIC_PATH}`,
  CONNECT_STR: debug ? CONNECT_STR_DEV : CONNECT_STR_PRO,
  FIRE_DIR,
  
  UPLOAD_DIR: debug ? LOCAL_STATIC_PATH : PROD_STATIC_PATH,
  JWT_SCRIPT,
  JWT_REFRESH_SCRIPT,

  JWT_EXPIRT_IN,
  JWT_REFRESH_EXPIRE_IN,
  needDb: true
}
